<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div p:first-child {
            color: red;
        }
        
        div span:first-child {
            color: blue;
        }
        
        div span:last-child {
            color: purple;
        }
        
        div p:last-child {
            color: purple;
        }
        
        div p:nth-child(1) {
            color: salmon;
        }
        
        div span:nth-child(3) {
            color: seagreen;
        }
        
        div b:nth-child(4) {
            color: royalblue;
        }
        
        div span:nth-child(7) {
            color: slateblue;
        }
        
        b:only-child {
            color: tomato;
        }
        /* ul li:nth-child(3) {
            color: tomato;
        } */
        /* ul li:nth-child(even) {
            color: pink;
        }
        
        ul li:nth-child(odd) {
            color: red;
        } */
        
        ul li:nth-child(2n+3) {
            color: turquoise;
        }
    </style>
</head>

<body>
    <div>
        <p>这是第一个p</p>
        <p>这是第二个p</p>
        <span>这是第一个span</span> <br>
        <b>我加粗了</b><br>
        <span>这是第二个span</span>
    </div>
    <ul>
        <li>哈哈哈哈1</li>
        <li>哈哈哈哈2</li>
        <li>哈哈哈哈3</li>
        <li>哈哈哈哈4</li>
        <li>哈哈哈哈5</li>
    </ul>
</body>

</html>